package FitNess;



import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.ResultSet;

import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.KeyStroke;

import net.proteanit.sql.DbUtils;

@SuppressWarnings("serial")
public class SousFenetreEntrainementPlanifie extends JFrame implements
		ActionListener {

	private JPanel panneau;
	private JMenuBar menu;
	private JMenuItem fermer;
	JScrollPane monJScrollPane; 
	JTable jTableClient;
	
	public SousFenetreEntrainementPlanifie(String req) {
		init(req);
	}

	public void init(String req) {
		panneau = new JPanel(new BorderLayout(20,20));
		menu = new JMenuBar();
		fermer = new JMenuItem();
		fermer.setMnemonic('X');
		fermer.setAccelerator(KeyStroke.getKeyStroke('X'));
		fermer.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent event) {
				System.exit(7);
			}
		});
		menu.add(fermer);
		monJScrollPane = new JScrollPane();
		jTableClient = new JTable();
		monJScrollPane.setViewportView(jTableClient);
		ResultSet rs = TestConnectionBDMysql.ExecuterRequeteSelection(req);
		jTableClient.setModel(DbUtils.resultSetToTableModel(rs));
		panneau.add(monJScrollPane,BorderLayout.NORTH); 
		this.setResizable(false);
		this.setJMenuBar(menu);
		this.setResizable(true);
		this.setVisible(true);
		this.add(panneau,BorderLayout.CENTER);
		pack();
		this.setSize(new Dimension(1078, 618));
		JFrame.setDefaultLookAndFeelDecorated(getFocusableWindowState());
		this.setDefaultCloseOperation(1);
	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		
	}
	
}